package com.zy.mc_module.mvp.contract;

import android.content.Context;
import com.zy.mc_module.mvp.base.BaseModel;
import com.zy.mc_module.mvp.base.IPresenter;
import com.zy.mc_module.mvp.base.IView;
import com.zy.mc_module.mvp.bean.BaseBean;
import com.zy.mc_module.mvp.bean.ProtocolBean;
import com.zy.mc_module.mvp.bean.TokenBean;
import com.zy.mc_module.mvp.bean.UserBean;

import io.reactivex.Observable;

/**
 * Created on 18/11/30
 */
public interface LoginContract {
    interface View extends IView {
        //获取验证码成功
        void onGetCodeSuccess(String success);

        //登录成功
        void onLoginSuccess(UserBean userBean);

        //验证码校验成功
        void onSuccess(boolean isSuc);

        <T> void onSuccess(T t, int type);
    }

    interface Model extends BaseModel {
        /***
         * 校验验证码并登录
         */
        Observable<BaseBean<UserBean>> checkLogin(Object... objects);

        /***
         * 账号密码登录
         */
        Observable<TokenBean> login(int type, String userName, String phone, String password);

        /***
         * 校验验证码
         */
        Observable<BaseBean> checkCode(String phone, String code);

        /***
         * 查询用户手机号是否注册
         */
        Observable<BaseBean<Boolean>> checkPhoneRegister(String phone);

        /***
         * 协议、规则文章查询
         */
        Observable<BaseBean<ProtocolBean>> queryArticleProtocol(String articleProtocolType, String queryType);
        /***
         * 绑定银行卡
         * @param objects
         * @return
         */
        Observable<BaseBean> bindBank(Object... objects);
        /***
         * 协议、规则文章查询
         */
        //Observable<BaseBean<ProtocolBean>> queryArticleProtocol(String articleProtocolType, String queryType);
    }

    interface Presenter extends IPresenter<View> {
        /***
         * 获取验证码
         */
        void getCode(Context context, String type, String tel);

        /***
         * 校验验证码并登录
         */
        void checkLogin(Context context, String tel, String code, String openid, String uuid, String nickname, String headimgurl);

        /***
         * 账号密码登录
         */
        void login(Context context, int type, String userName, String phone, String password);

        /***
         * 校验验证码
         */
        void checkCode(Context context, String tel, String code);

    }
}

